classic_battlefield_moddingfandomcom-20200214-history
AI Behaviors Explained
Understanding AI Behaviors by Dnamro AI Behavior templates define the frequency that bots will perform certain actions, called behaviors. We can create the AI behavior templates or create new ones to customize vehicles. We will look at the AIbehaviors from the realplayer mod. These are the defined behaviors: aiSettings.setNBehaviours 8 (There are 8 behaviors) aiSettings.setBehaviour 0 Avoid (move out of the way of something) aiSettings.setBehaviour 1 MoveTo (go some where) aiSettings.setBehaviour 2 Idle (do nothing) aiSettings.setBehaviour 3 Fire (Use a hand/vehicle weapon) aiSettings.setBehaviour 4 Scout (search for the enemy) aiSettings.setBehaviour 5 TakeCover (hide from the enemy) aiSettings.setBehaviour 6 Change (Exit a vehicle ) aiSettings.setBehaviour 7 Special These are the vehicle AI behavior template name definitions: rem *** Set number of vehicles and id/name mappings *** aiSettings.setNVehiclesTypes 20 (there are only 18 behaviors defined in the standard game) aiSettings.setVehicle 0 Tank aiSettings.setVehicle 1 Plane aiSettings.setVehicle 2 Boat aiSettings.setVehicle 3 Infantery (yes this is misspelled, and infantery are just bots without a vehicle) aiSettings.setVehicle 4 Fixed aiSettings.setVehicle 5 Car aiSettings.setVehicle 6 UnarmedTank aiSettings.setVehicle 7 LandingCraft aiSettings.setVehicle 8 Passenger aiSettings.setVehicle 9 BoatFixed aiSettings.setVehicle 10 LandingCraftPassenger aiSettings.setVehicle 11 LandingCraftFixed aiSettings.setVehicle 12 UnarmedBoat aiSettings.setVehicle 13 FixedLargeBore aiSettings.setVehicle 14 ArtilleryDriver aiSettings.setVehicle 15 UnarmedPlane aiSettings.setVehicle 16 AmphibiousCar aiSettings.setVehicle 17 FixedGuidedMissileLauncher aiSettings.setVehicle 18 Submarine (This is a custom AI behavior template) aiSettings.setVehicle 19 ArmedBoat (This is a custom AI behavior template) ---- rem *** IMPORTANT !!! ************************** rem * NEVER ALLOW IDLE's urgency to become 0. * rem * The AI will CRASH in that case. * rem *** REMINDER ******************************* ---- Weights are where we can change the weight of certain behaviors. This is the key to the changes for Realplayer. Realplayer has additional custom Weight types for some of the vehicle types and increased the Fire behavior weight for vehicles with weapons, as well as decreasing the idle behavior. In Plane weights the avoid behavior is greatly increased from 0. aiSettings.createBehaviourModifiers UnitWeights aiSettings.setBehaviourModifier Avoid 1.0 aiSettings.setBehaviourModifier MoveTo 1.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 7.5 aiSettings.setBehaviourModifier Special 1.0 aiSettings.setBehaviourModifier Scout 1.0 aiSettings.setBehaviourModifier TakeCover 1.0 aiSettings.setBehaviourModifier Change 1.0 aiSettings.createBehaviourModifiers BoatWeights aiSettings.setBehaviourModifier Avoid 1.0 aiSettings.setBehaviourModifier MoveTo 3.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 7.5 aiSettings.setBehaviourModifier Special 0.01 aiSettings.setBehaviourModifier Scout 1.0 aiSettings.setBehaviourModifier TakeCover 0.01 aiSettings.setBehaviourModifier Change 0.1 aiSettings.createBehaviourModifiers UnarmedWeights aiSettings.setBehaviourModifier Avoid 1.0 aiSettings.setBehaviourModifier MoveTo 1.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 0.0 aiSettings.setBehaviourModifier Special 1.0 aiSettings.setBehaviourModifier Scout 1.0 aiSettings.setBehaviourModifier TakeCover 1.0 aiSettings.setBehaviourModifier Change 1.0 aiSettings.createBehaviourModifiers StandardWeights aiSettings.setBehaviourModifier Avoid 1.0 aiSettings.setBehaviourModifier MoveTo 1.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 7.5 aiSettings.setBehaviourModifier Special 1.0 aiSettings.setBehaviourModifier Scout 1.0 aiSettings.setBehaviourModifier TakeCover 1.0 aiSettings.setBehaviourModifier Change 1.0 aiSettings.createBehaviourModifiers TankWeights aiSettings.setBehaviourModifier Avoid 1.0 aiSettings.setBehaviourModifier MoveTo 1.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 7.5 aiSettings.setBehaviourModifier Special 1.0 aiSettings.setBehaviourModifier Scout 1.0 aiSettings.setBehaviourModifier TakeCover 1.0 aiSettings.setBehaviourModifier Change 1.0 aiSettings.createBehaviourModifiers InfantryWeights aiSettings.setBehaviourModifier Avoid 1.0 aiSettings.setBehaviourModifier MoveTo 3.0 aiSettings.setBehaviourModifier Idle 0.0001 aiSettings.setBehaviourModifier Fire 7.5 aiSettings.setBehaviourModifier Special 2.0 aiSettings.setBehaviourModifier Scout 1.0 aiSettings.setBehaviourModifier TakeCover 1.0 aiSettings.setBehaviourModifier Change 1.0 aiSettings.createBehaviourModifiers PlaneWeights aiSettings.setBehaviourModifier Avoid 7.5 aiSettings.setBehaviourModifier MoveTo 1.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 7.5 aiSettings.setBehaviourModifier Special 1.0 aiSettings.setBehaviourModifier Scout 1.0 aiSettings.setBehaviourModifier TakeCover 0.0 aiSettings.setBehaviourModifier Change 0.1 rem *** Construct submarine weights *** aiSettings.createBehaviourModifiers SubWeights aiSettings.setBehaviourModifier Avoid 1.0 aiSettings.setBehaviourModifier MoveTo 2.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 7.5 aiSettings.setBehaviourModifier Special 0.0 aiSettings.setBehaviourModifier Scout 1.0 aiSettings.setBehaviourModifier TakeCover 0.0 aiSettings.setBehaviourModifier Change 0.01 Now lets look at the custom submarine AI behavior template, and you will notice that it has custom Sub weights:: rem *** Submarine Behaviour setup *** aiSettings.setVehicleBehaviour Submarine Avoid BBAvoid BBPAvoidCollision2d 1 0 UCUnion AvoidInhibit aiSettings.setVehicleBehaviour Submarine MoveTo BBMoveTo BBPGotoWaypoint2d 4 0 UCUnion SubWeights aiSettings.setVehicleBehaviour Submarine Idle BBIdle BBPIdle2d 5 0 UCUnion SubWeights aiSettings.setVehicleBehaviour Submarine Fire BBFireInfantery BBPFireInfantery 4 0 UCFire SubWeights aiSettings.setVehicleBehaviour Submarine Scout BBScout BBPScout 8 0 UCUnion SubWeights aiSettings.setVehicleBehaviour Submarine Change BBChangeTeleport BBPChangeTeleport 6 0 UCUnion ChangeInhibit aiSettings.setVehicleDefaultBehaviour Submarine Idle aiSettings.addInterpreterEntry Submarine InfoWrapper aiSettings.addInterpreterEntry Submarine BoatMoveTo aiSettings.addInterpreterEntry Submarine BoatMoveToDirection aiSettings.addInterpreterEntry Submarine BoatMoveToObject aiSettings.addInterpreterEntry Submarine Trigger aiSettings.addInterpreterEntry Submarine TriggerContinously aiSettings.addInterpreterEntry Submarine MouseTurretLookAt aiSettings.addInterpreterEntry Submarine MouseTurretAimAt aiSettings.addInterpreterEntry Submarine Sense aiSettings.addInterpreterEntry Submarine BoatResetControls aiSettings.activateDefaultInterpreter Submarine BAPSTParallel Full aiSettings.activateDefaultInterpreter Submarine BAPSTSerial Full aiSettings.activateDefaultInterpreter Submarine BAPSTIf Full aiSettings.activateDefaultInterpreter Submarine BAPSTPlanEnd Full aiSettings.activateDefaultInterpreter Submarine BAPSTWait Full aiSettings.activateDefaultInterpreter Submarine BAPSTWhile Full aiSettings.activateDefaultInterpreter Submarine BAPSTWeaponWrapper Full aiSettings.activateDefaultInterpreter Submarine BAPSTAimingWrapper Full aiSettings.activateDefaultInterpreter Submarine BAPSTFinishedWrapper Full aiSettings.activateDefaultInterpreter Submarine BAPSTUpdateVehicle Full aiSettings.activateDefaultInterpreter Submarine BAPSTChangeWeapon Full aiSettings.activateDefaultInterpreter Submarine BAPSTICTurnLock Full aiSettings.activateDefaultInterpreter Submarine BAPSTICChangeVehicle Full aiSettings.activateDefaultInterpreter Submarine BAPSTICScout Full aiSettings.activateDefaultInterpreter Submarine BAPSTEvaluate Full aiSettings.activateDefaultInterpreter Submarine BAPSTNotifyBot Full aiSettings.activateDefaultInterpreter Submarine BAPSTIdle Full Compared to Plane AI behavior template, and you will see that in addition to custom PlaneWeights, it also has 3d behaviors, custom PlaneAvoidInhibit and PlaneChangeInhibit behaviors: rem *** Plane Behaviour setup *** rem aiSettings.setVehicleBehaviour Plane Avoid BBAvoid BBPAvoidCollision3d 1 0 UCUnion PlaneAvoidInhibit aiSettings.setVehicleBehaviour Plane MoveTo BBMoveTo BBPGotoWaypoint3d 4 0 UCUnion PlaneWeights aiSettings.setVehicleBehaviour Plane Idle BBIdle BBPIdle3d 5 0 UCUnion PlaneWeights aiSettings.setVehicleBehaviour Plane Fire BBFire3d BBPFire3d 4 0 UCFire PlaneWeights rem aiSettings.setVehicleBehaviour Plane Special BBRoam BBPRoam3d 6 0 UCUnion PlaneWeights aiSettings.setVehicleBehaviour Plane Change BBChange BBPChange 6 0 UCUnion PlaneChangeInhibit aiSettings.setVehicleDefaultBehaviour Plane Idle rem aiSettings.setVehicleBehaviour Plane TakeCover BBTakeCover3d BBPTakeCover3d 4 0 UCUnion UnitWeights aiSettings.addInterpreterEntry Plane InfoWrapper aiSettings.addInterpreterEntry Plane PlaneMoveTo aiSettings.addInterpreterEntry Plane PlaneMoveToDirection aiSettings.addInterpreterEntry Plane PlaneMoveToObject aiSettings.addInterpreterEntry Plane Trigger aiSettings.addInterpreterEntry Plane TriggerContinously aiSettings.addInterpreterEntry Plane PlaneAimAt aiSettings.addInterpreterEntry Plane PlaneResetControls aiSettings.addInterpreterEntry Plane PlaneRoll aiSettings.addInterpreterEntry Plane Sense aiSettings.activateDefaultInterpreter Plane BAPSTParallel Full aiSettings.activateDefaultInterpreter Plane BAPSTSerial Full aiSettings.activateDefaultInterpreter Plane BAPSTIf Full aiSettings.activateDefaultInterpreter Plane BAPSTWait Full aiSettings.activateDefaultInterpreter Plane BAPSTWhile Full rem aiSettings.activateDefaultInterpreter Plane BAPSTInfoWrapper Full aiSettings.activateDefaultInterpreter Plane BAPSTWeaponWrapper Full aiSettings.activateDefaultInterpreter Plane BAPSTFinishedWrapper Full aiSettings.activateDefaultInterpreter Plane BAPSTUpdateVehicle Full aiSettings.activateDefaultInterpreter Plane BAPSTChangeWeapon Full aiSettings.activateDefaultInterpreter Plane BAPSTICTurnLock Full aiSettings.activateDefaultInterpreter Plane BAPSTICChangeVehicle Full aiSettings.activateDefaultInterpreter Plane BAPSTICScout Full aiSettings.activateDefaultInterpreter Plane BAPSTEvaluate Full aiSettings.activateDefaultInterpreter Plane BAPSTNotifyBot Full aiSettings.activateDefaultInterpreter Plane BAPSTIdle Full rem *** Construct Change Inhibit *** aiSettings.createBehaviourModifiers PlaneChangeInhibit aiSettings.setBehaviourModifier Avoid 0.8 aiSettings.setBehaviourModifier MoveTo 0.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 0.75 aiSettings.setBehaviourModifier Special 0.0 aiSettings.setBehaviourModifier Scout 0.5 aiSettings.setBehaviourModifier TakeCover 1.0 aiSettings.setBehaviourModifier Change 0.1 rem *** Construct Avoid inhibitors *** aiSettings.createBehaviourModifiers PlaneAvoidInhibit aiSettings.setBehaviourModifier Avoid 7.5 aiSettings.setBehaviourModifier MoveTo 0.0 aiSettings.setBehaviourModifier Idle 0.01 aiSettings.setBehaviourModifier Fire 0.0 aiSettings.setBehaviourModifier Special 1.0 aiSettings.setBehaviourModifier Scout 0.0 aiSettings.setBehaviourModifier TakeCover 0.0 aiSettings.setBehaviourModifier Change 0.1